
<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>4. Modules &#8212; onusim  documentation</title>
    <link rel="stylesheet" href="../_static/nature.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../_static/extra.css" />
    <script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script src="../_static/jquery.js"></script>
    <script src="../_static/underscore.js"></script>
    <script src="../_static/doctools.js"></script>
    <script src="../_static/language_data.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="5. Documentation" href="../usage/documentation.html" />
    <link rel="prev" title="3. Scripts" href="../bin/index.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../usage/documentation.html" title="5. Documentation"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="../bin/index.html" title="3. Scripts"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">onusim  documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href=""><span class="section-number">4. </span>Modules</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="modules">
<h1><span class="section-number">4. </span>Modules<a class="headerlink" href="#modules" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-obbaa_onusim.endpoint">
<span id="endpoint"></span><h2><span class="section-number">4.1. </span>Endpoint<a class="headerlink" href="#module-obbaa_onusim.endpoint" title="Permalink to this headline">¶</a></h2>
<p>An endpoint is an OMCI client or server.</p>
<p>Endpoints are modeled by instances of the <a class="reference internal" href="#obbaa_onusim.endpoint.Endpoint" title="obbaa_onusim.endpoint.Endpoint"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Endpoint</span></code></a> class. Examples:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">client</span> <span class="o">=</span> <span class="n">Endpoint</span><span class="p">((</span><span class="n">address</span><span class="p">,</span> <span class="n">port</span><span class="p">),</span> <span class="n">is_server</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">cterm_name</span><span class="o">=</span><span class="s1">&#39;foo&#39;</span><span class="p">,</span>
                  <span class="n">onu_id_range</span><span class="o">=</span><span class="nb">range</span><span class="p">(</span><span class="mi">100</span><span class="p">))</span>
<span class="n">message</span> <span class="o">=</span> <span class="o">...</span>
<span class="n">client</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">message</span><span class="p">)</span>
<span class="n">response</span><span class="p">,</span> <span class="n">address</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">recv</span><span class="p">()</span>
<span class="n">client</span><span class="o">.</span><span class="n">process</span><span class="p">(</span><span class="n">response</span><span class="p">)</span>
</pre></div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">server</span> <span class="o">=</span> <span class="n">Endpoint</span><span class="p">((</span><span class="n">address</span><span class="p">,</span> <span class="n">port</span><span class="p">),</span> <span class="n">is_server</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">cterm_name</span><span class="o">=</span><span class="s1">&#39;foo&#39;</span><span class="p">,</span>
                  <span class="n">onu_id_range</span><span class="o">=</span><span class="nb">range</span><span class="p">(</span><span class="mi">100</span><span class="p">))</span>
<span class="n">message</span><span class="p">,</span> <span class="n">address</span> <span class="o">=</span> <span class="n">server</span><span class="o">.</span><span class="n">recv</span><span class="p">()</span>
<span class="n">response</span> <span class="o">=</span> <span class="n">server</span><span class="o">.</span><span class="n">process</span><span class="p">(</span><span class="n">message</span><span class="p">)</span>
<span class="k">if</span> <span class="n">response</span><span class="p">:</span>
    <span class="n">server</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">response</span><span class="p">,</span> <span class="n">address</span><span class="p">)</span>
</pre></div>
</div>
<dl class="py class">
<dt id="obbaa_onusim.endpoint.Endpoint">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.endpoint.</code><code class="sig-name descname">Endpoint</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">server_address</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">is_server</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">cterm_name</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">onu_id_range</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">tr451</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">10</span></em>, <em class="sig-param"><span class="n">dumpfd</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.endpoint.Endpoint" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Models an OMCI client or server instance.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>There should probably be an <code class="docutils literal notranslate"><span class="pre">Endpoint</span></code> base class with <code class="docutils literal notranslate"><span class="pre">Client</span></code>
and <code class="docutils literal notranslate"><span class="pre">Server</span></code> subclasses.</p>
</div>
<dl class="py method">
<dt id="obbaa_onusim.endpoint.Endpoint.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">server_address</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">is_server</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">cterm_name</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">onu_id_range</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">tr451</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">timeout</span><span class="o">=</span><span class="default_value">10</span></em>, <em class="sig-param"><span class="n">dumpfd</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.endpoint.Endpoint.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Create an OMCI endpoint instance.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>server_address</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>]) – Server address (and port). Clients send to this
address; servers listen on it.</p></li>
<li><p><strong>is_server</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – Whether or not this endpoint is a server.</p></li>
<li><p><strong>cterm_name</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]) – Channel termination name. Clients include this name
in all messages. Servers will process only messages that
contain it.</p></li>
<li><p><strong>onu_id_range</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">range</span></code>]) – ONU id range, e.g. <code class="docutils literal notranslate"><span class="pre">range(10)</span></code> means ONU ids 0, 1,
…9. Ignored by clients. Servers will process only messages
that contain one of these ONU ids.</p></li>
<li><p><strong>tr451</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – Whether to process TR-451 (<code class="docutils literal notranslate"><span class="pre">cterm_name</span></code>, <code class="docutils literal notranslate"><span class="pre">onu_id</span></code>)
headers.</p></li>
<li><p><strong>timeout</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – Clients will time out after this number of seconds.
Ignored by servers.</p></li>
<li><p><strong>dumpfd</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">IO</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]]) – File to which to send hex dumps of all sent and received
messages (ignoring the TR-451 header).</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.endpoint.Endpoint.recv">
<code class="sig-name descname">recv</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">bufsize</span><span class="o">=</span><span class="default_value">2048</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.endpoint.Endpoint.recv" title="Permalink to this definition">¶</a></dt>
<dd><p>Receive a buffer from the server socket and decode it as a
message.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>bufsize</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – Buffer size in bytes.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>]]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Decoded message and the address from which it was received.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.endpoint.Endpoint.process">
<code class="sig-name descname">process</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">message</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.endpoint.Endpoint.process" title="Permalink to this definition">¶</a></dt>
<dd><p>Process a received message.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>message</strong> (<a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a>) – Message to process.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a>]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>None (if no response is requested) or the response.</p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Messages that don’t have an expected <code class="docutils literal notranslate"><span class="pre">cterm_name</span></code> or
<code class="docutils literal notranslate"><span class="pre">onu_id</span></code> will be ignored and no response will be sent. This is
probably wrong.</p>
</div>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.endpoint.Endpoint.send">
<code class="sig-name descname">send</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">message</span></em>, <em class="sig-param"><span class="n">address</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.endpoint.Endpoint.send" title="Permalink to this definition">¶</a></dt>
<dd><p>Send a message to the server or the specified address.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>message</strong> (<a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a>) – Message to send.</p></li>
<li><p><strong>address</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>]]) – Address to send the message to. Defaults to the server
address.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.endpoint.Endpoint.server_address">
<em class="property">property </em><code class="sig-name descname">server_address</code><a class="headerlink" href="#obbaa_onusim.endpoint.Endpoint.server_address" title="Permalink to this definition">¶</a></dt>
<dd><p>Server address.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>]</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.endpoint.Endpoint.database">
<em class="property">property </em><code class="sig-name descname">database</code><a class="headerlink" href="#obbaa_onusim.endpoint.Endpoint.database" title="Permalink to this definition">¶</a></dt>
<dd><p>Database object.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><a class="reference internal" href="#obbaa_onusim.database.Database" title="obbaa_onusim.database.Database"><code class="xref py py-class docutils literal notranslate"><span class="pre">Database</span></code></a></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.endpoint.Endpoint.__str__">
<code class="sig-name descname">__str__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.endpoint.Endpoint.__str__" title="Permalink to this definition">¶</a></dt>
<dd><p>Return str(self).</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="messages-and-actions">
<h2><span class="section-number">4.2. </span>Messages and Actions<a class="headerlink" href="#messages-and-actions" title="Permalink to this headline">¶</a></h2>
<div class="section" id="module-obbaa_onusim.message">
<span id="message-classes"></span><h3>Message classes<a class="headerlink" href="#module-obbaa_onusim.message" title="Permalink to this headline">¶</a></h3>
<p>OMCI messages are modeled by subclasses of the <a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Message</span></code></a> base class.</p>
<p><code class="xref any docutils literal notranslate"><span class="pre">Message</span></code> instances can be created in two ways:</p>
<blockquote>
<div><ul class="simple">
<li><p>Directly via <a class="reference internal" href="#obbaa_onusim.message.Message.__init__" title="obbaa_onusim.message.Message.__init__"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">Message.__init__</span></code></a>: this is how clients create requests and
servers create responses and notifications</p></li>
<li><p>By calling <a class="reference internal" href="#obbaa_onusim.message.Message.decode" title="obbaa_onusim.message.Message.decode"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">Message.decode</span></code></a> to decode a received message: this is how
servers decode requests and clients decode responses and notifications</p></li>
</ul>
</div></blockquote>
<p>Examples:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">values</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;battery_backup&#39;</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span>
<span class="n">message</span> <span class="o">=</span> <span class="n">Set</span><span class="p">(</span><span class="n">cterm_name</span><span class="o">=</span><span class="s1">&#39;foo&#39;</span><span class="p">,</span> <span class="n">onu_id</span><span class="o">=</span><span class="mi">42</span><span class="p">,</span> <span class="n">tci</span><span class="o">=</span><span class="mi">42</span><span class="p">,</span> <span class="n">extended</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
              <span class="n">me_class</span><span class="o">=</span><span class="mi">256</span><span class="p">,</span> <span class="n">me_inst</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">values</span><span class="o">=</span><span class="n">values</span><span class="p">)</span>

<span class="c1"># common fields can be put in a dictionary and used like this</span>
<span class="n">common</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;cterm_name&#39;</span><span class="p">:</span> <span class="s1">&#39;foo&#39;</span><span class="p">,</span> <span class="s1">&#39;onu_id&#39;</span><span class="p">:</span> <span class="mi">42</span><span class="p">,</span> <span class="s1">&#39;tci&#39;</span><span class="p">:</span> <span class="mi">42</span><span class="p">,</span> <span class="s1">&#39;extended&#39;</span><span class="p">:</span> <span class="kc">False</span><span class="p">}</span>
<span class="n">message</span> <span class="o">=</span> <span class="n">Set</span><span class="p">(</span><span class="n">me_class</span><span class="o">=</span><span class="mi">256</span><span class="p">,</span> <span class="n">me_inst</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">values</span><span class="o">=</span><span class="n">values</span><span class="p">,</span> <span class="o">**</span><span class="n">common</span><span class="p">)</span>

<span class="n">buffer</span><span class="p">,</span> <span class="n">address</span> <span class="o">=</span> <span class="n">sock</span><span class="o">.</span><span class="n">recvfrom</span><span class="p">(</span><span class="n">bufsize</span><span class="p">)</span>
<span class="n">message</span> <span class="o">=</span> <span class="n">Message</span><span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="n">buffer</span><span class="p">)</span>

<span class="c1"># the __str__() method returns a user-friendly string representation</span>
<span class="nb">print</span><span class="p">(</span><span class="n">message</span><span class="p">)</span>
</pre></div>
</div>
<dl class="py class">
<dt id="obbaa_onusim.message.Message">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.message.</code><code class="sig-name descname">Message</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">_no_validate</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">fields</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.message.Message" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p><code class="xref any docutils literal notranslate"><span class="pre">Message</span></code> base class.</p>
<p>The methods are documented in a logical order corresponding to a
message’s life-cycle:</p>
<ul class="simple">
<li><p><a class="reference internal" href="#obbaa_onusim.message.Message.__init__" title="obbaa_onusim.message.Message.__init__"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">__init__</span></code></a> constructs the message from its field values</p></li>
<li><p><a class="reference internal" href="#obbaa_onusim.message.Message.encode" title="obbaa_onusim.message.Message.encode"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">encode</span></code></a> converts the message to an OMCI buffer</p></li>
<li><p>(the buffer is now presumably sent over the network)</p></li>
<li><p><a class="reference internal" href="#obbaa_onusim.message.Message.decode" title="obbaa_onusim.message.Message.decode"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">decode</span></code></a> converts an OMCI buffer back to a message</p></li>
<li><p><a class="reference internal" href="#obbaa_onusim.message.Message.process" title="obbaa_onusim.message.Message.process"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">process</span></code></a> processes the message, maybe constructing a response message</p></li>
</ul>
<dl class="py method">
<dt id="obbaa_onusim.message.Message.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">_no_validate</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">fields</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.message.Message.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p><code class="xref any docutils literal notranslate"><span class="pre">Message</span></code> base class constructor.</p>
<p>Subclasses will not usually need to provide their own constructors
because they can supply their own fields via the base class
constructor.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>_no_validate</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – This is for internal use only.</p></li>
<li><p><strong>**fields</strong> – <p>Keyword arguments. There are several categories of
field:</p>
<ol class="arabic simple">
<li><p>The TR-451 header fields (<code class="docutils literal notranslate"><span class="pre">cterm_name</span></code>, <code class="docutils literal notranslate"><span class="pre">onu_id=42</span></code>)
must always be supplied</p></li>
<li><p>The OMCI message type fields (<code class="docutils literal notranslate"><span class="pre">type_ar</span></code>, <code class="docutils literal notranslate"><span class="pre">type_ak</span></code>,
<code class="docutils literal notranslate"><span class="pre">type_mt</span></code>) are handled automatically and so must not be
supplied</p></li>
<li><p>These OMCI header fields have defaults but can be
overridden:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">tci</span></code> (Transaction Correlation Identifier); 0-65535;
default 0</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">extended</span></code> (whether to use extended messages);
default False</p></li>
</ul>
</li>
<li><p>These OMCI header fields do not have defaults and therefore
must be supplied:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">me_class</span></code> (Managed Entity Class); 0-65535</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">me_inst</span></code> (Managed Entity Instance); 0-65535</p></li>
</ul>
</li>
<li><p>Any additional fields are message type specific</p></li>
</ol>
</p></li>
</ul>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p><code class="xref any docutils literal notranslate"><span class="pre">Message</span></code> base class instances can’t be instantiated. Only
instances of subclasses, e.g. <a class="reference internal" href="#obbaa_onusim.actions.set.Set" title="obbaa_onusim.actions.set.Set"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Set</span></code></a> and <a class="reference internal" href="#obbaa_onusim.actions.get.Get" title="obbaa_onusim.actions.get.Get"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Get</span></code></a>, can be
instantiated.</p>
</div>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.message.Message.validate">
<code class="sig-name descname">validate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.message.Message.validate" title="Permalink to this definition">¶</a></dt>
<dd><p>Validate a message, returning a dictionary of modified fields.</p>
<p>This is primarily intended for when an application calls the
constructor directly and therefore have supplied some invalid fields.</p>
<p>If this method detects an unrecoverable error, it should raise an
exception.</p>
<p>The base class implementation just returns an empty dictionary.
Subclasses should override this method.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code>]]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Dictionary mapping field names to field values. The instance
will be updated with these fields.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.message.Message.encode">
<code class="sig-name descname">encode</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">tr451</span><span class="o">=</span><span class="default_value">True</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.message.Message.encode" title="Permalink to this definition">¶</a></dt>
<dd><p>Encode this message into a buffer.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>tr451</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – Whether to add a TR-451 header to the buffer.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The encoded buffer.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.message.Message.encode_contents">
<code class="sig-name descname">encode_contents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.message.Message.encode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Encode this message’s contents, i.e. its type-specific payload.</p>
<p>The base class implementation just returns an empty buffer.
Subclasses should override this method.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Encoded buffer.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.message.Message.decode">
<em class="property">classmethod </em><code class="sig-name descname">decode</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">buffer</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">tr451</span><span class="o">=</span><span class="default_value">True</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.message.Message.decode" title="Permalink to this definition">¶</a></dt>
<dd><p>Decode a buffer, returning a <a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Message</span></code></a> instance of the
appropriate type.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>buffer</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>]) – Buffer, e.g. just received from a socket.</p></li>
<li><p><strong>tr451</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – Whether the buffer has a TR-451 header.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Message</span></code></a> instance of the appropriate type.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.message.Message.decode_contents">
<code class="sig-name descname">decode_contents</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">contents</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.message.Message.decode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Decode this message’s contents, i.e. its type-specific payload.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>contents</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>) – The contents part of the buffer.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code>]]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Dictionary mapping field names to field values. The instance
will be updated with these fields.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.message.Message.process">
<code class="sig-name descname">process</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">endpoint</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.message.Message.process" title="Permalink to this definition">¶</a></dt>
<dd><p>Pass this message to the endpoint for processing, and return the
response (if any).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>endpoint</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code>) – Endpoint to which to pass the message for processing.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a>]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The response, or <code class="docutils literal notranslate"><span class="pre">None</span></code> if there is no response.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.message.Message.get">
<code class="sig-name descname">get</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.message.Message.get" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the value of the named field.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – Field name.</p></li>
<li><p><strong>default</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code>, <code class="docutils literal notranslate"><span class="pre">None</span></code>]) – Value to return if the field doesn’t exist.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code>]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Field value.</p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>It will usually be more convenient to rely on the fact that
<code class="docutils literal notranslate"><span class="pre">__getattr__</span></code> has been defined to return field values directly.
Assuming that field <code class="docutils literal notranslate"><span class="pre">foo</span></code> exists, these are the same:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="bp">self</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">foo</span>
</pre></div>
</div>
<p>As with dictionaries, if you’re not sure whether the field
exists, it’s safer to use <code class="xref any docutils literal notranslate"><span class="pre">get()</span></code>.</p>
</div>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.message.Message.set">
<code class="sig-name descname">set</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">value</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.message.Message.set" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the value of the named field.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – Field name.</p></li>
<li><p><strong>value</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code>]) – Field value.</p></li>
</ul>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The field name isn’t checked, so it’s possible to inadvertently
create new fields using this method.</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.message.Message.__str__">
<code class="sig-name descname">__str__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.message.Message.__str__" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a user-friendly representation of a message.</p>
<p>Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">values</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;battery_backup&#39;</span><span class="p">:</span> <span class="kc">True</span><span class="p">}</span>
<span class="n">message</span> <span class="o">=</span> <span class="n">Set</span><span class="p">(</span><span class="n">cterm_name</span><span class="o">=</span><span class="s1">&#39;foo&#39;</span><span class="p">,</span> <span class="n">onu_id</span><span class="o">=</span><span class="mi">42</span><span class="p">,</span> <span class="n">tci</span><span class="o">=</span><span class="mi">84</span><span class="p">,</span> <span class="n">me_class</span><span class="o">=</span><span class="mi">256</span><span class="p">,</span>
              <span class="n">me_inst</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">values</span><span class="o">=</span><span class="n">values</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">message</span><span class="p">)</span>

<span class="o">-&gt;</span>

<span class="n">Set</span><span class="p">(</span><span class="n">attr_mask</span><span class="o">=</span><span class="mh">0x400</span><span class="p">,</span> <span class="n">cterm_name</span><span class="o">=</span><span class="s1">&#39;foo&#39;</span><span class="p">,</span> <span class="n">extended</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
    <span class="n">me_class</span><span class="o">=</span><span class="mi">256</span><span class="p">,</span> <span class="n">me_inst</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">onu_id</span><span class="o">=</span><span class="mi">42</span><span class="p">,</span> <span class="n">tci</span><span class="o">=</span><span class="mi">84</span><span class="p">,</span>
    <span class="n">values</span><span class="o">=</span><span class="p">{</span><span class="s1">&#39;battery_backup&#39;</span><span class="p">:</span> <span class="mi">1</span><span class="p">})</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Oops. This example shows that value conversion between user and
raw units isn’t yet complete.</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-obbaa_onusim.action">
<span id="action-classes"></span><h3>Action classes<a class="headerlink" href="#module-obbaa_onusim.action" title="Permalink to this headline">¶</a></h3>
<p>An action is an operation, typically involving a command/response
message round-trip.</p>
<dl class="py class">
<dt id="obbaa_onusim.action.Action">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.action.</code><code class="sig-name descname">Action</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">number</span></em>, <em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">request</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.action.Action" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.NumberName" title="obbaa_onusim.types.NumberName"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.NumberName</span></code></a>, <a class="reference internal" href="#obbaa_onusim.types.AutoGetter" title="obbaa_onusim.types.AutoGetter"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.AutoGetter</span></code></a></p>
<p><code class="xref any docutils literal notranslate"><span class="pre">Action</span></code> class.</p>
<dl class="py method">
<dt id="obbaa_onusim.action.Action.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">number</span></em>, <em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">request</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">response</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.action.Action.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p><code class="xref any docutils literal notranslate"><span class="pre">Action</span></code> constructor.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>number</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – Action number. This is the OMCI message type (
<code class="docutils literal notranslate"><span class="pre">type_mt</span></code>) for the action’s request and response messages.</p></li>
<li><p><strong>name</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – Action name. This is only used for documentation purposes.</p></li>
<li><p><strong>description</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]) – Action description. This is only used for
documentation purposes.</p></li>
<li><p><strong>request</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">Type</span></code>[<a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a>]]) – Request message class.</p></li>
<li><p><strong>response</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">Type</span></code>[<a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a>]]) – Response message class. If <code class="docutils literal notranslate"><span class="pre">None</span></code> no response is
expected.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.action.Arg">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.action.</code><code class="sig-name descname">Arg</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">number</span></em>, <em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">data</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">cond</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.action.Arg" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.NumberName" title="obbaa_onusim.types.NumberName"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.NumberName</span></code></a>, <a class="reference internal" href="#obbaa_onusim.types.AutoGetter" title="obbaa_onusim.types.AutoGetter"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.AutoGetter</span></code></a></p>
<dl class="py method">
<dt id="obbaa_onusim.action.Arg.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">number</span></em>, <em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">data</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">cond</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.action.Arg.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize self.  See help(type(self)) for accurate signature.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-obbaa_onusim.actions.set">
<span id="set-action"></span><h3>Set action<a class="headerlink" href="#module-obbaa_onusim.actions.set" title="Permalink to this headline">¶</a></h3>
<p>The Set action’s messages are defined in G.988 A.2.5-6 (extended) and
A.3.5-6 (baseline).</p>
<p>The relevant classes and instances are:</p>
<ul class="simple">
<li><p><a class="reference internal" href="#obbaa_onusim.actions.set.Set" title="obbaa_onusim.actions.set.Set"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Set</span></code></a>: Set command message class</p></li>
<li><p><a class="reference internal" href="#obbaa_onusim.actions.set.SetResponse" title="obbaa_onusim.actions.set.SetResponse"><code class="xref any py py-class docutils literal notranslate"><span class="pre">SetResponse</span></code></a>: Set response message class</p></li>
<li><p><a class="reference internal" href="#obbaa_onusim.actions.set.set_action" title="obbaa_onusim.actions.set.set_action"><code class="xref any py py-data docutils literal notranslate"><span class="pre">set_action</span></code></a>: Set action instance</p></li>
</ul>
<dl class="py class">
<dt id="obbaa_onusim.actions.set.Set">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.actions.set.</code><code class="sig-name descname">Set</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">_no_validate</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">fields</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.set.Set" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.message.Message</span></code></a></p>
<p>Set command message.</p>
<dl class="py method">
<dt id="obbaa_onusim.actions.set.Set.validate">
<code class="sig-name descname">validate</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.set.Set.validate" title="Permalink to this definition">¶</a></dt>
<dd><p>Validate the <code class="docutils literal notranslate"><span class="pre">values</span></code> field (a dictionary), returning new values
for the  <code class="docutils literal notranslate"><span class="pre">attr_mask</span></code> and <code class="docutils literal notranslate"><span class="pre">values</span></code> fields.</p>
<p>For each item in the <code class="docutils literal notranslate"><span class="pre">values</span></code> dictionary:</p>
<blockquote>
<div><ul class="simple">
<li><p>Check it’s a valid attribute name or number</p></li>
<li><p>Check it’s a writable attribute</p></li>
</ul>
</div></blockquote>
<p>If any of the checks fail, output a warning and ignore the attribute.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code>]]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><dl class="simple">
<dt>Dictionary with the following items.</dt><dd><ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">attr_mask</span></code>: attribute mask containing bits for valid
attributes from the supplied values</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">values</span></code>: dictionary containing valid attributes from the
supplied values, and with raw attribute values</p></li>
</ul>
</dd>
</dl>
</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.actions.set.Set.encode_contents">
<code class="sig-name descname">encode_contents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.set.Set.encode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Encode this message’s contents, i.e. its type-specific payload.</p>
<p>The base class implementation just returns an empty buffer.
Subclasses should override this method.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Encoded buffer.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.actions.set.Set.decode_contents">
<code class="sig-name descname">decode_contents</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">contents</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.set.Set.decode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Decode this message’s contents, i.e. its type-specific payload.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code>]]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>Dictionary with the following items.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">attr_mask</span></code>: attribute mask; 0-65535</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">values</span></code>: MIB-specific attribute names and values as specified
by the attribute mask</p></li>
</ul>
</p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p><code class="xref any docutils literal notranslate"><span class="pre">Set</span></code> and <a class="reference internal" href="#obbaa_onusim.actions.get.GetResponse" title="obbaa_onusim.actions.get.GetResponse"><code class="xref any py py-class docutils literal notranslate"><span class="pre">GetResponse</span></code></a> are inconsistent: here the dictionary
contains a <code class="docutils literal notranslate"><span class="pre">values</span></code> item, but <a class="reference internal" href="#obbaa_onusim.actions.get.GetResponse" title="obbaa_onusim.actions.get.GetResponse"><code class="xref any py py-class docutils literal notranslate"><span class="pre">GetResponse</span></code></a> places the
attributes directly in the object. This inconsistency will be
resolved.</p>
</div>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.actions.set.Set.process">
<code class="sig-name descname">process</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">server</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.set.Set.process" title="Permalink to this definition">¶</a></dt>
<dd><p>Pass this message to the endpoint for processing, and return the
response (if any).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>endpoint</strong> – Endpoint to which to pass the message for processing.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#obbaa_onusim.actions.set.SetResponse" title="obbaa_onusim.actions.set.SetResponse"><code class="xref py py-class docutils literal notranslate"><span class="pre">SetResponse</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The response, or <code class="docutils literal notranslate"><span class="pre">None</span></code> if there is no response.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.actions.set.SetResponse">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.actions.set.</code><code class="sig-name descname">SetResponse</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">_no_validate</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">fields</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.set.SetResponse" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.message.Message</span></code></a></p>
<p>Set response message.</p>
<dl class="py method">
<dt id="obbaa_onusim.actions.set.SetResponse.encode_contents">
<code class="sig-name descname">encode_contents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.set.SetResponse.encode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Encode this message’s contents, i.e. its type-specific payload.</p>
<p>The base class implementation just returns an empty buffer.
Subclasses should override this method.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Encoded buffer.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.actions.set.SetResponse.decode_contents">
<code class="sig-name descname">decode_contents</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">contents</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.set.SetResponse.decode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Decode this message’s contents, i.e. its type-specific payload.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code>]]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>Dictionary with the following items.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">reason</span></code>: result, reason; 0-255</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">attr_mask</span></code>: attribute mask; 0-65535</p></li>
<li><p>If <code class="docutils literal notranslate"><span class="pre">reason</span></code> is <code class="docutils literal notranslate"><span class="pre">0b1001</span></code> (9):
* <code class="docutils literal notranslate"><span class="pre">opt_attr_mask</span></code>: optional-attribute mask; 0-65535
* <code class="docutils literal notranslate"><span class="pre">opt_exec_mask</span></code>: attribute execution mask; 0-65535</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py data">
<dt id="obbaa_onusim.actions.set.set_action">
<code class="sig-prename descclassname">obbaa_onusim.actions.set.</code><code class="sig-name descname">set_action</code><em class="property"> = Action(number=8, name='set', description='Set action')</em><a class="headerlink" href="#obbaa_onusim.actions.set.set_action" title="Permalink to this definition">¶</a></dt>
<dd><p>Set <a class="reference internal" href="#obbaa_onusim.action.Action" title="obbaa_onusim.action.Action"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Action</span></code></a>.</p>
<p>This specifies the message type and provides a link between the action’s
command and response messages.</p>
</dd></dl>

</div>
<div class="section" id="module-obbaa_onusim.actions.get">
<span id="get-action"></span><h3>Get action<a class="headerlink" href="#module-obbaa_onusim.actions.get" title="Permalink to this headline">¶</a></h3>
<p>The Get action’s messages are defined in G.988 A.2.7-8 (extended) and
A.3.7-8 (baseline).</p>
<p>The relevant classes and instances are:</p>
<ul class="simple">
<li><p><a class="reference internal" href="#obbaa_onusim.actions.get.Get" title="obbaa_onusim.actions.get.Get"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Get</span></code></a>: Get command message class</p></li>
<li><p><a class="reference internal" href="#obbaa_onusim.actions.get.GetResponse" title="obbaa_onusim.actions.get.GetResponse"><code class="xref any py py-class docutils literal notranslate"><span class="pre">GetResponse</span></code></a>: Get response message class</p></li>
<li><p><a class="reference internal" href="#obbaa_onusim.actions.get.get_action" title="obbaa_onusim.actions.get.get_action"><code class="xref any py py-data docutils literal notranslate"><span class="pre">get_action</span></code></a>: Get action instance.</p></li>
</ul>
<dl class="py class">
<dt id="obbaa_onusim.actions.get.Get">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.actions.get.</code><code class="sig-name descname">Get</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">_no_validate</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">fields</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.get.Get" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.message.Message</span></code></a></p>
<p>Get command message.</p>
<dl class="py method">
<dt id="obbaa_onusim.actions.get.Get.encode_contents">
<code class="sig-name descname">encode_contents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.get.Get.encode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Encode this message’s contents, i.e. its type-specific payload.</p>
<p>The base class implementation just returns an empty buffer.
Subclasses should override this method.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Encoded buffer.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.actions.get.Get.decode_contents">
<code class="sig-name descname">decode_contents</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">contents</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.get.Get.decode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Decode this message’s contents, i.e. its type-specific payload.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code>]]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>Dictionary with the following items.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">attr_mask</span></code>: attribute mask; 0-65535</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.actions.get.Get.process">
<code class="sig-name descname">process</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">server</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.get.Get.process" title="Permalink to this definition">¶</a></dt>
<dd><p>Pass this message to the endpoint for processing, and return the
response (if any).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>endpoint</strong> – Endpoint to which to pass the message for processing.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#obbaa_onusim.actions.get.GetResponse" title="obbaa_onusim.actions.get.GetResponse"><code class="xref py py-class docutils literal notranslate"><span class="pre">GetResponse</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The response, or <code class="docutils literal notranslate"><span class="pre">None</span></code> if there is no response.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.actions.get.GetResponse">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.actions.get.</code><code class="sig-name descname">GetResponse</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">_no_validate</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">fields</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.get.GetResponse" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.message.Message</span></code></a></p>
<p>Get response message.</p>
<dl class="py method">
<dt id="obbaa_onusim.actions.get.GetResponse.encode_contents">
<code class="sig-name descname">encode_contents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.get.GetResponse.encode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Encode this message’s contents, i.e. its type-specific payload.</p>
<p>The base class implementation just returns an empty buffer.
Subclasses should override this method.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Encoded buffer.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.actions.get.GetResponse.decode_contents">
<code class="sig-name descname">decode_contents</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">contents</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.get.GetResponse.decode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Decode this message’s contents, i.e. its type-specific payload.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code>]]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>Dictionary with the following items.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">reason</span></code>: result, reason; 0-255</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">attr_mask</span></code>: attribute mask; 0-65535</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">opt_attr_mask</span></code>: optional-attribute mask; 0-65535</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">opt_exec_mask</span></code>: attribute execution mask; 0-65535</p></li>
<li><p>other: MIB-specific attributes as specified by the
attribute mask</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py data">
<dt id="obbaa_onusim.actions.get.get_action">
<code class="sig-prename descclassname">obbaa_onusim.actions.get.</code><code class="sig-name descname">get_action</code><em class="property"> = Action(number=9, name='get', description='Get action')</em><a class="headerlink" href="#obbaa_onusim.actions.get.get_action" title="Permalink to this definition">¶</a></dt>
<dd><p>Get <a class="reference internal" href="#obbaa_onusim.action.Action" title="obbaa_onusim.action.Action"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Action</span></code></a>.</p>
<p>This specifies the message type and provides a link between the action’s
command and response messages.</p>
</dd></dl>

</div>
<div class="section" id="module-obbaa_onusim.actions.upload">
<span id="mib-upload-and-mib-upload-next-actions"></span><h3>MIB upload and  MIB upload next actions<a class="headerlink" href="#module-obbaa_onusim.actions.upload" title="Permalink to this headline">¶</a></h3>
<p>The MIB upload and MIB upload next actions’ messages are defined in
G.988 A.2.13-16 (extended) and A.3.13-16 (baseline).</p>
<p>The relevant classes and instances are:</p>
<ul class="simple">
<li><p><a class="reference internal" href="#obbaa_onusim.actions.upload.MibUpload" title="obbaa_onusim.actions.upload.MibUpload"><code class="xref any py py-class docutils literal notranslate"><span class="pre">MibUpload</span></code></a> and <a class="reference internal" href="#obbaa_onusim.actions.upload.MibUploadNext" title="obbaa_onusim.actions.upload.MibUploadNext"><code class="xref any py py-class docutils literal notranslate"><span class="pre">MibUploadNext</span></code></a>: MIB upload and MIB upload next command
message classes</p></li>
<li><p><a class="reference internal" href="#obbaa_onusim.actions.upload.MibUploadResponse" title="obbaa_onusim.actions.upload.MibUploadResponse"><code class="xref any py py-class docutils literal notranslate"><span class="pre">MibUploadResponse</span></code></a> and <a class="reference internal" href="#obbaa_onusim.actions.upload.MibUploadNextResponse" title="obbaa_onusim.actions.upload.MibUploadNextResponse"><code class="xref any py py-class docutils literal notranslate"><span class="pre">MibUploadNextResponse</span></code></a>: MIB upload and MIB upload
next response message classes</p></li>
<li><p><a class="reference internal" href="#obbaa_onusim.actions.upload.mib_upload_action" title="obbaa_onusim.actions.upload.mib_upload_action"><code class="xref any py py-data docutils literal notranslate"><span class="pre">mib_upload_action</span></code></a> and <a class="reference internal" href="#obbaa_onusim.actions.upload.mib_upload_next_action" title="obbaa_onusim.actions.upload.mib_upload_next_action"><code class="xref any py py-data docutils literal notranslate"><span class="pre">mib_upload_next_action</span></code></a>: MIB upload and MIB
upload next action instances.</p></li>
</ul>
<dl class="py class">
<dt id="obbaa_onusim.actions.upload.MibUpload">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.actions.upload.</code><code class="sig-name descname">MibUpload</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">_no_validate</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">fields</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.upload.MibUpload" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.message.Message</span></code></a></p>
<p>MIB upload command message.</p>
<dl class="py method">
<dt id="obbaa_onusim.actions.upload.MibUpload.process">
<code class="sig-name descname">process</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">server</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.upload.MibUpload.process" title="Permalink to this definition">¶</a></dt>
<dd><p>Pass this message to the endpoint for processing, and return the
response (if any).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>endpoint</strong> – Endpoint to which to pass the message for processing.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#obbaa_onusim.actions.upload.MibUploadResponse" title="obbaa_onusim.actions.upload.MibUploadResponse"><code class="xref py py-class docutils literal notranslate"><span class="pre">MibUploadResponse</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The response, or <code class="docutils literal notranslate"><span class="pre">None</span></code> if there is no response.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.actions.upload.MibUploadResponse">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.actions.upload.</code><code class="sig-name descname">MibUploadResponse</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">_no_validate</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">fields</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.upload.MibUploadResponse" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.message.Message</span></code></a></p>
<p>MIB upload response message.</p>
<dl class="py method">
<dt id="obbaa_onusim.actions.upload.MibUploadResponse.encode_contents">
<code class="sig-name descname">encode_contents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.upload.MibUploadResponse.encode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Encode this message’s contents, i.e. its type-specific payload.</p>
<p>The base class implementation just returns an empty buffer.
Subclasses should override this method.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Encoded buffer.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.actions.upload.MibUploadResponse.decode_contents">
<code class="sig-name descname">decode_contents</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">contents</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.upload.MibUploadResponse.decode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Decode this message’s contents, i.e. its type-specific payload.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code>]]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>Dictionary with the following items.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">num_upload_nexts</span></code>: number of <a class="reference internal" href="#obbaa_onusim.actions.upload.MibUploadNext" title="obbaa_onusim.actions.upload.MibUploadNext"><code class="xref any py py-class docutils literal notranslate"><span class="pre">MibUploadNext</span></code></a> commands
required; 0-65535</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.actions.upload.MibUploadNext">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.actions.upload.</code><code class="sig-name descname">MibUploadNext</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">_no_validate</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">fields</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.upload.MibUploadNext" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.message.Message</span></code></a></p>
<p>MIB upload next command message.</p>
<dl class="py method">
<dt id="obbaa_onusim.actions.upload.MibUploadNext.encode_contents">
<code class="sig-name descname">encode_contents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.upload.MibUploadNext.encode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Encode this message’s contents, i.e. its type-specific payload.</p>
<p>The base class implementation just returns an empty buffer.
Subclasses should override this method.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Encoded buffer.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.actions.upload.MibUploadNext.decode_contents">
<code class="sig-name descname">decode_contents</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">contents</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.upload.MibUploadNext.decode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Decode this message’s contents, i.e. its type-specific payload.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code>]]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>Dictionary with the following items.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">seq_num</span></code>: command sequence number; 0-65535</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.actions.upload.MibUploadNext.process">
<code class="sig-name descname">process</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">server</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.upload.MibUploadNext.process" title="Permalink to this definition">¶</a></dt>
<dd><p>Pass this message to the endpoint for processing, and return the
response (if any).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>endpoint</strong> – Endpoint to which to pass the message for processing.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#obbaa_onusim.actions.upload.MibUploadNextResponse" title="obbaa_onusim.actions.upload.MibUploadNextResponse"><code class="xref py py-class docutils literal notranslate"><span class="pre">MibUploadNextResponse</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The response, or <code class="docutils literal notranslate"><span class="pre">None</span></code> if there is no response.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.actions.upload.MibUploadNextResponse">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.actions.upload.</code><code class="sig-name descname">MibUploadNextResponse</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">_no_validate</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">fields</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.upload.MibUploadNextResponse" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.message.Message</span></code></a></p>
<p>MIB upload next response message.</p>
<dl class="py method">
<dt id="obbaa_onusim.actions.upload.MibUploadNextResponse.encode_contents">
<code class="sig-name descname">encode_contents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.upload.MibUploadNextResponse.encode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Encode this message’s contents, i.e. its type-specific payload.</p>
<p>The base class implementation just returns an empty buffer.
Subclasses should override this method.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Encoded buffer.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.actions.upload.MibUploadNextResponse.decode_contents">
<code class="sig-name descname">decode_contents</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">contents</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.upload.MibUploadNextResponse.decode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Decode this message’s contents, i.e. its type-specific payload.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code>]]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>Dictionary with the following items.</p>
<ul class="simple">
<li><dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">me_class.me_inst.attr_name</span></code>: the item name is the</dt><dd><p>dot-separated ME class (MIB number), ME instance,
and attribute name.</p>
</dd>
</dl>
</li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py data">
<dt id="obbaa_onusim.actions.upload.mib_upload_action">
<code class="sig-prename descclassname">obbaa_onusim.actions.upload.</code><code class="sig-name descname">mib_upload_action</code><em class="property"> = Action(number=13, name='mib-upload', description='MIB upload action')</em><a class="headerlink" href="#obbaa_onusim.actions.upload.mib_upload_action" title="Permalink to this definition">¶</a></dt>
<dd><p>MIB upload <a class="reference internal" href="#obbaa_onusim.action.Action" title="obbaa_onusim.action.Action"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Action</span></code></a>.</p>
<p>This specifies the message type and provides a link between the action’s
command and response messages.</p>
</dd></dl>

<dl class="py data">
<dt id="obbaa_onusim.actions.upload.mib_upload_next_action">
<code class="sig-prename descclassname">obbaa_onusim.actions.upload.</code><code class="sig-name descname">mib_upload_next_action</code><em class="property"> = Action(number=14, name='mib-upload-next', description='MIB upload next action')</em><a class="headerlink" href="#obbaa_onusim.actions.upload.mib_upload_next_action" title="Permalink to this definition">¶</a></dt>
<dd><p>MIB upload next <a class="reference internal" href="#obbaa_onusim.action.Action" title="obbaa_onusim.action.Action"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Action</span></code></a>.</p>
<p>This specifies the message type and provides a link between the action’s
command and response messages.</p>
</dd></dl>

</div>
<div class="section" id="module-obbaa_onusim.actions.reset">
<span id="mib-reset-action"></span><h3>MIB reset action<a class="headerlink" href="#module-obbaa_onusim.actions.reset" title="Permalink to this headline">¶</a></h3>
<p>The MIB reset action’s messages are defined in G.988 A.2.17-18 (
extended) and A.3.17-18 (baseline).</p>
<p>The relevant classes and instances are:</p>
<ul class="simple">
<li><p><a class="reference internal" href="#obbaa_onusim.actions.reset.MibReset" title="obbaa_onusim.actions.reset.MibReset"><code class="xref any py py-class docutils literal notranslate"><span class="pre">MibReset</span></code></a>: MIB reset command message class</p></li>
<li><p><a class="reference internal" href="#obbaa_onusim.actions.reset.MibResetResponse" title="obbaa_onusim.actions.reset.MibResetResponse"><code class="xref any py py-class docutils literal notranslate"><span class="pre">MibResetResponse</span></code></a>: MIB reset response message class</p></li>
<li><p><a class="reference internal" href="#obbaa_onusim.actions.reset.mib_reset_action" title="obbaa_onusim.actions.reset.mib_reset_action"><code class="xref any py py-data docutils literal notranslate"><span class="pre">mib_reset_action</span></code></a>: MIB reset action instance.</p></li>
</ul>
<dl class="py class">
<dt id="obbaa_onusim.actions.reset.MibReset">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.actions.reset.</code><code class="sig-name descname">MibReset</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">_no_validate</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">fields</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.reset.MibReset" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.message.Message</span></code></a></p>
<p>MIB reset command message.</p>
<dl class="py method">
<dt id="obbaa_onusim.actions.reset.MibReset.process">
<code class="sig-name descname">process</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">server</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.reset.MibReset.process" title="Permalink to this definition">¶</a></dt>
<dd><p>Pass this message to the server database for processing,
and return the response.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><a class="reference internal" href="#obbaa_onusim.actions.reset.MibResetResponse" title="obbaa_onusim.actions.reset.MibResetResponse"><code class="xref py py-class docutils literal notranslate"><span class="pre">MibResetResponse</span></code></a></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.actions.reset.MibResetResponse">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.actions.reset.</code><code class="sig-name descname">MibResetResponse</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">_no_validate</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">fields</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.reset.MibResetResponse" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.message.Message" title="obbaa_onusim.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.message.Message</span></code></a></p>
<p>MIB reset response message.</p>
<dl class="py method">
<dt id="obbaa_onusim.actions.reset.MibResetResponse.encode_contents">
<code class="sig-name descname">encode_contents</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.reset.MibResetResponse.encode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Encode this message’s contents, i.e. its type-specific payload.</p>
<p>The base class implementation just returns an empty buffer.
Subclasses should override this method.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Encoded buffer.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.actions.reset.MibResetResponse.decode_contents">
<code class="sig-name descname">decode_contents</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">contents</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.actions.reset.MibResetResponse.decode_contents" title="Permalink to this definition">¶</a></dt>
<dd><p>Decode this message’s contents, i.e. its type-specific payload.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Dict</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code>]]</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p>Dictionary with the following items.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">reason</span></code>: result, reason; 0-255</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py data">
<dt id="obbaa_onusim.actions.reset.mib_reset_action">
<code class="sig-prename descclassname">obbaa_onusim.actions.reset.</code><code class="sig-name descname">mib_reset_action</code><em class="property"> = Action(number=15, name='mib-reset', description='MIB reset action')</em><a class="headerlink" href="#obbaa_onusim.actions.reset.mib_reset_action" title="Permalink to this definition">¶</a></dt>
<dd><p>MIB reset <a class="reference internal" href="#obbaa_onusim.action.Action" title="obbaa_onusim.action.Action"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Action</span></code></a>.</p>
<p>This specifies the message type and provides a link between the action’s
command and response messages.</p>
</dd></dl>

</div>
</div>
<div class="section" id="mibs">
<h2><span class="section-number">4.3. </span>MIBs<a class="headerlink" href="#mibs" title="Permalink to this headline">¶</a></h2>
<div class="section" id="module-obbaa_onusim.mib">
<span id="mib-classes"></span><h3>MIB classes<a class="headerlink" href="#module-obbaa_onusim.mib" title="Permalink to this headline">¶</a></h3>
<p>A MIB (Management Information Base), also referred to as an ME (Managed
Entity), is defined via a <a class="reference internal" href="#obbaa_onusim.mib.MIB" title="obbaa_onusim.mib.MIB"><code class="xref any py py-class docutils literal notranslate"><span class="pre">MIB</span></code></a> instance.</p>
<p>A MIB definition describes its <a class="reference internal" href="#obbaa_onusim.mib.Attr" title="obbaa_onusim.mib.Attr"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Attrs</span></code></a> (attributes), <a class="reference internal" href="#obbaa_onusim.action.Action" title="obbaa_onusim.action.Action"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Actions</span></code></a>,
<a class="reference internal" href="#obbaa_onusim.mib.Notification" title="obbaa_onusim.mib.Notification"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Notifications</span></code></a>, <a class="reference internal" href="#obbaa_onusim.mib.Change" title="obbaa_onusim.mib.Change"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Changes</span></code></a> and <a class="reference internal" href="#obbaa_onusim.mib.Alarm" title="obbaa_onusim.mib.Alarm"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Alarms</span></code></a>.</p>
<p>Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">onu_data_mib</span> <span class="o">=</span> <span class="n">MIB</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="s1">&#39;ONU_DATA&#39;</span><span class="p">,</span> <span class="s1">&#39;Models the MIB itself&#39;</span><span class="p">,</span> <span class="n">attrs</span><span class="o">=</span><span class="p">(</span>
  <span class="n">Attr</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="s1">&#39;me_inst&#39;</span><span class="p">,</span> <span class="s1">&#39;Managed entity instance&#39;</span><span class="p">,</span> <span class="n">R</span><span class="p">,</span> <span class="n">M</span><span class="p">,</span> <span class="n">Number</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">fixed</span><span class="o">=</span><span class="mi">0</span><span class="p">)),</span>
  <span class="n">Attr</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="s1">&#39;mib_data_sync&#39;</span><span class="p">,</span> <span class="s1">&#39;MIB data sync&#39;</span><span class="p">,</span> <span class="n">RW</span><span class="p">,</span> <span class="n">M</span><span class="p">,</span> <span class="n">Number</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span>
<span class="p">),</span> <span class="n">actions</span><span class="o">=</span> <span class="p">(</span>
  <span class="n">get_action</span><span class="p">,</span> <span class="n">set_action</span><span class="p">,</span> <span class="n">get_all_alarms_action</span><span class="p">,</span>
  <span class="n">get_all_alarms_next_action</span><span class="p">,</span> <span class="n">mib_reset_action</span><span class="p">,</span> <span class="n">mib_upload_action</span><span class="p">,</span>
  <span class="n">mib_upload_next_action</span>
<span class="p">))</span>
</pre></div>
</div>
<dl class="py data">
<dt id="obbaa_onusim.mib.mibs">
<code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">mibs</code><em class="property"> = {mib.number: mib for mib in all-MIB-instances}</em><a class="headerlink" href="#obbaa_onusim.mib.mibs" title="Permalink to this definition">¶</a></dt>
<dd><p>All instantiated MIBs.</p>
</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.mib.MIB">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">MIB</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">number</span></em>, <em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">attrs</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">actions</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">notifications</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">changes</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">alarms</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.MIB" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.NumberName" title="obbaa_onusim.types.NumberName"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.NumberName</span></code></a>, <a class="reference internal" href="#obbaa_onusim.types.AutoGetter" title="obbaa_onusim.types.AutoGetter"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.AutoGetter</span></code></a></p>
<p>MIB definition class.</p>
<dl class="py method">
<dt id="obbaa_onusim.mib.MIB.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">number</span></em>, <em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">attrs</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">actions</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">notifications</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">changes</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">alarms</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.MIB.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>MIB class constructor.</p>
<p>The constructor adds new MIB instances to the <a class="reference internal" href="#obbaa_onusim.mib.mibs" title="obbaa_onusim.mib.mibs"><code class="xref any py py-data docutils literal notranslate"><span class="pre">mibs</span></code></a> dictionary.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>number</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – MIB number; MUST be unique across all MIB
instances; 0-65535.</p></li>
<li><p><strong>name</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – MIB name; MUST be unique across all MIB instances.</p></li>
<li><p><strong>description</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]) – MIB description; used only for documentation purposes.</p></li>
<li><p><strong>attrs</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference internal" href="#obbaa_onusim.mib.Attr" title="obbaa_onusim.mib.Attr"><code class="xref py py-class docutils literal notranslate"><span class="pre">Attr</span></code></a>, …]]) – MIB attributes. They’re defined as a tuple but each has a
number, so order doesn’t matter.</p></li>
<li><p><strong>actions</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference internal" href="#obbaa_onusim.action.Action" title="obbaa_onusim.action.Action"><code class="xref py py-class docutils literal notranslate"><span class="pre">Action</span></code></a>, …]]) – Actions valid for use with this MIB.</p></li>
<li><p><strong>notifications</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference internal" href="#obbaa_onusim.mib.Notification" title="obbaa_onusim.mib.Notification"><code class="xref py py-class docutils literal notranslate"><span class="pre">Notification</span></code></a>, …]]) – Notifications generated by this MIB.</p></li>
<li><p><strong>changes</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference internal" href="#obbaa_onusim.mib.Change" title="obbaa_onusim.mib.Change"><code class="xref py py-class docutils literal notranslate"><span class="pre">Change</span></code></a>, …]]) – Changes generated by this MIB.</p></li>
<li><p><strong>alarms</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference internal" href="#obbaa_onusim.mib.Alarm" title="obbaa_onusim.mib.Alarm"><code class="xref py py-class docutils literal notranslate"><span class="pre">Alarm</span></code></a>, …]]) – Alarms generated by this MIB.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.mib.MIB.attr">
<code class="sig-name descname">attr</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">number_or_name</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.MIB.attr" title="Permalink to this definition">¶</a></dt>
<dd><p>Find a MIB attribute by number or name, returning the attribute or
None.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>number_or_name</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]) – MIB attribute number or name.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<a class="reference internal" href="#obbaa_onusim.mib.Attr" title="obbaa_onusim.mib.Attr"><code class="xref py py-class docutils literal notranslate"><span class="pre">Attr</span></code></a>]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><a class="reference internal" href="#obbaa_onusim.mib.Attr" title="obbaa_onusim.mib.Attr"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Attr</span></code></a> instance or <code class="docutils literal notranslate"><span class="pre">None</span></code> if not found.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.mib.MIB.attr_names">
<code class="sig-name descname">attr_names</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">access</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.MIB.attr_names" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a (string representation of) a list of all attribute
names, optionally restricted to those with a specified access level.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>access</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<a class="reference internal" href="#obbaa_onusim.mib.Access" title="obbaa_onusim.mib.Access"><code class="xref py py-class docutils literal notranslate"><span class="pre">Access</span></code></a>]) – Desired access level, or <code class="docutils literal notranslate"><span class="pre">None</span></code> to return all attributes.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>String of the form <code class="docutils literal notranslate"><span class="pre">name1,</span> <span class="pre">name2,</span> <span class="pre">name3</span></code>.</p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Attribute 0 is <code class="docutils literal notranslate"><span class="pre">me_inst</span></code> (the ME instance number) and is not
returned.</p>
</div>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.mib.Attr">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">Attr</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">number</span></em>, <em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">access</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">requirement</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">data</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.Attr" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.NumberName" title="obbaa_onusim.types.NumberName"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.NumberName</span></code></a>, <a class="reference internal" href="#obbaa_onusim.types.AutoGetter" title="obbaa_onusim.types.AutoGetter"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.AutoGetter</span></code></a></p>
<p>MIB attribute class.</p>
<dl class="py method">
<dt id="obbaa_onusim.mib.Attr.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">number</span></em>, <em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">access</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">requirement</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">data</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.Attr.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>MIB attribute constructor.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>number</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – attribute number; MUST be unique within its MIB; 0-16.</p></li>
<li><p><strong>name</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – attribute name; MUST be unique within its MIB.</p></li>
<li><p><strong>description</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]) – attribute description; used only for documentation
purposes.</p></li>
<li><p><strong>access</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<a class="reference internal" href="#obbaa_onusim.mib.Access" title="obbaa_onusim.mib.Access"><code class="xref py py-class docutils literal notranslate"><span class="pre">Access</span></code></a>]) – attribute access level.</p></li>
<li><p><strong>requirement</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<a class="reference internal" href="#obbaa_onusim.mib.Requirement" title="obbaa_onusim.mib.Requirement"><code class="xref py py-class docutils literal notranslate"><span class="pre">Requirement</span></code></a>]) – attribute support requirement</p></li>
<li><p><strong>data</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<a class="reference internal" href="#obbaa_onusim.types.Datum" title="obbaa_onusim.types.Datum"><code class="xref py py-class docutils literal notranslate"><span class="pre">Datum</span></code></a>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<a class="reference internal" href="#obbaa_onusim.types.Datum" title="obbaa_onusim.types.Datum"><code class="xref py py-class docutils literal notranslate"><span class="pre">Datum</span></code></a>, …], <code class="docutils literal notranslate"><span class="pre">None</span></code>]) – attribute data specification.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.mib.Attr.decode">
<code class="sig-name descname">decode</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">content</span></em>, <em class="sig-param"><span class="n">offset</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.Attr.decode" title="Permalink to this definition">¶</a></dt>
<dd><p>Decode a MIB attribute value.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>content</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>) – buffer from which to decode the value.</p></li>
<li><p><strong>offset</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – byte offset within buffer at which to start decoding.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>], …]], <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><p>Decoded values and updated offset.</p>
<ul class="simple">
<li><p>The decoded values are returned as a tuple (if there’s more than
one value), a single value, or <code class="docutils literal notranslate"><span class="pre">None</span></code></p></li>
<li><p>The offset is ready to be passed to the next <code class="docutils literal notranslate"><span class="pre">decode</span></code>
invocation</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.mib.Attr.encode">
<code class="sig-name descname">encode</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">values</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.Attr.encode" title="Permalink to this definition">¶</a></dt>
<dd><p>Encode a MIB attribute value.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>values</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>], …], <code class="docutils literal notranslate"><span class="pre">None</span></code>]) – tuple, single value or <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Encoded buffer. If <code class="docutils literal notranslate"><span class="pre">None</span></code> was supplied, an empty buffer is
returned.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.mib.Attr.resolve">
<code class="sig-name descname">resolve</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">values</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.Attr.resolve" title="Permalink to this definition">¶</a></dt>
<dd><p>Resolve a MIB attribute value by invoking any callable values.</p>
<p>Any callable values are invoked (with no arguments) and are replaced
with the returned value. See <a class="reference internal" href="#obbaa_onusim.database.Database" title="obbaa_onusim.database.Database"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Database</span></code></a> for an example.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>values</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>], …], <code class="docutils literal notranslate"><span class="pre">None</span></code>]) – tuple, single value or <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>], …]]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Resolved values. If <code class="docutils literal notranslate"><span class="pre">None</span></code> was supplied, then <code class="docutils literal notranslate"><span class="pre">None</span></code> is
returned.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.mib.Attr.mask">
<em class="property">property </em><code class="sig-name descname">mask</code><a class="headerlink" href="#obbaa_onusim.mib.Attr.mask" title="Permalink to this definition">¶</a></dt>
<dd><p>Get this attribute’s mask, e.g. the value to use when forming the
<a class="reference internal" href="#obbaa_onusim.actions.get.Get" title="obbaa_onusim.actions.get.Get"><code class="xref any py py-class docutils literal notranslate"><span class="pre">Get</span></code></a> command’s <code class="docutils literal notranslate"><span class="pre">attr_mask</span></code> field.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Don’t call this on attribute 0 (<code class="docutils literal notranslate"><span class="pre">me_inst</span></code>). You’ll get an
assertion failure.</p>
</div>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.mib.Attr.size">
<em class="property">property </em><code class="sig-name descname">size</code><a class="headerlink" href="#obbaa_onusim.mib.Attr.size" title="Permalink to this definition">¶</a></dt>
<dd><p>Get this attribute’s value size in bytes.</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.mib.Access">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">Access</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.Access" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.Name" title="obbaa_onusim.types.Name"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.Name</span></code></a>, <a class="reference internal" href="#obbaa_onusim.types.AutoGetter" title="obbaa_onusim.types.AutoGetter"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.AutoGetter</span></code></a></p>
<p>Attribute access class (G.988 Section 9).</p>
<dl class="py method">
<dt id="obbaa_onusim.mib.Access.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.Access.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize self.  See help(type(self)) for accurate signature.</p>
</dd></dl>

</dd></dl>

<dl class="py data">
<dt id="obbaa_onusim.mib.R">
<code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">R</code><em class="property"> = Access(name='R')</em><a class="headerlink" href="#obbaa_onusim.mib.R" title="Permalink to this definition">¶</a></dt>
<dd><p>Read-only access.</p>
</dd></dl>

<dl class="py data">
<dt id="obbaa_onusim.mib.W">
<code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">W</code><em class="property"> = Access(name='W')</em><a class="headerlink" href="#obbaa_onusim.mib.W" title="Permalink to this definition">¶</a></dt>
<dd><p>Write-only access.</p>
</dd></dl>

<dl class="py data">
<dt id="obbaa_onusim.mib.RW">
<code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">RW</code><em class="property"> = Access(name='RW')</em><a class="headerlink" href="#obbaa_onusim.mib.RW" title="Permalink to this definition">¶</a></dt>
<dd><p>Read-Write access.</p>
</dd></dl>

<dl class="py data">
<dt id="obbaa_onusim.mib.RC">
<code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">RC</code><em class="property"> = Access(name='RC')</em><a class="headerlink" href="#obbaa_onusim.mib.RC" title="Permalink to this definition">¶</a></dt>
<dd><p>Read and set-by-Create access.</p>
</dd></dl>

<dl class="py data">
<dt id="obbaa_onusim.mib.RWC">
<code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">RWC</code><em class="property"> = Access(name='RWC')</em><a class="headerlink" href="#obbaa_onusim.mib.RWC" title="Permalink to this definition">¶</a></dt>
<dd><p>Read-Write and set-by-Create access.</p>
</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.mib.Requirement">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">Requirement</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.Requirement" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.Name" title="obbaa_onusim.types.Name"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.Name</span></code></a>, <a class="reference internal" href="#obbaa_onusim.types.AutoGetter" title="obbaa_onusim.types.AutoGetter"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.AutoGetter</span></code></a></p>
<p>Attribute requirement class.</p>
<dl class="py method">
<dt id="obbaa_onusim.mib.Requirement.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.Requirement.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize self.  See help(type(self)) for accurate signature.</p>
</dd></dl>

</dd></dl>

<dl class="py data">
<dt id="obbaa_onusim.mib.M">
<code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">M</code><em class="property"> = Requirement(name='M')</em><a class="headerlink" href="#obbaa_onusim.mib.M" title="Permalink to this definition">¶</a></dt>
<dd><p>Mandatory</p>
</dd></dl>

<dl class="py data">
<dt id="obbaa_onusim.mib.O">
<code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">O</code><em class="property"> = Requirement(name='O')</em><a class="headerlink" href="#obbaa_onusim.mib.O" title="Permalink to this definition">¶</a></dt>
<dd><p>Optional</p>
</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.mib.Notification">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">Notification</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">names</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.Notification" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.Name" title="obbaa_onusim.types.Name"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.Name</span></code></a>, <a class="reference internal" href="#obbaa_onusim.types.AutoGetter" title="obbaa_onusim.types.AutoGetter"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.AutoGetter</span></code></a></p>
<p>Attribute notification class.</p>
</dd></dl>

<dl class="py data">
<dt id="obbaa_onusim.mib.test_result_notification">
<code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">test_result_notification</code><em class="property"> = Notification(name='test_result')</em><a class="headerlink" href="#obbaa_onusim.mib.test_result_notification" title="Permalink to this definition">¶</a></dt>
<dd><p>Test result notification.</p>
</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.mib.Change">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">Change</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">number</span></em>, <em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">names</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.Change" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.NumberName" title="obbaa_onusim.types.NumberName"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.NumberName</span></code></a></p>
<p>Attribute change class.</p>
</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.mib.Alarm">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.mib.</code><code class="sig-name descname">Alarm</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">number</span></em>, <em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">names</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.mib.Alarm" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.NumberName" title="obbaa_onusim.types.NumberName"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.NumberName</span></code></a></p>
<p>Attribute alarm class.</p>
</dd></dl>

</div>
<div class="section" id="module-obbaa_onusim.mibs.onu_g">
<span id="onu-g-mib"></span><h3>ONU-G MIB<a class="headerlink" href="#module-obbaa_onusim.mibs.onu_g" title="Permalink to this headline">¶</a></h3>
<p>ONU-G MIB (G.988 9.1.1).</p>
<dl class="py data">
<dt id="obbaa_onusim.mibs.onu_g.onu_g_mib">
<code class="sig-prename descclassname">obbaa_onusim.mibs.onu_g.</code><code class="sig-name descname">onu_g_mib</code><em class="property"> = MIB(number=256, name='ONU-G', description='Represents the ONU as equipment')</em><a class="headerlink" href="#obbaa_onusim.mibs.onu_g.onu_g_mib" title="Permalink to this definition">¶</a></dt>
<dd><p>Instantiated <a class="reference internal" href="#obbaa_onusim.mib.MIB" title="obbaa_onusim.mib.MIB"><code class="xref any py py-class docutils literal notranslate"><span class="pre">MIB</span></code></a>.</p>
</dd></dl>

</div>
<div class="section" id="module-obbaa_onusim.mibs.onu2_g">
<span id="onu2-g-mib"></span><h3>ONU2-G MIB<a class="headerlink" href="#module-obbaa_onusim.mibs.onu2_g" title="Permalink to this headline">¶</a></h3>
<p>ONU2-G MIB (G.988 9.1.2).</p>
<dl class="py data">
<dt id="obbaa_onusim.mibs.onu2_g.onu2_g_mib">
<code class="sig-prename descclassname">obbaa_onusim.mibs.onu2_g.</code><code class="sig-name descname">onu2_g_mib</code><em class="property"> = MIB(number=257, name='ONU2-G', description='Contains additional attributes associated with a PON ONU')</em><a class="headerlink" href="#obbaa_onusim.mibs.onu2_g.onu2_g_mib" title="Permalink to this definition">¶</a></dt>
<dd><p>Instantiated <a class="reference internal" href="#obbaa_onusim.mib.MIB" title="obbaa_onusim.mib.MIB"><code class="xref any py py-class docutils literal notranslate"><span class="pre">MIB</span></code></a>.</p>
</dd></dl>

</div>
<div class="section" id="module-obbaa_onusim.mibs.onu_data">
<span id="onu-data-mib"></span><h3>ONU data MIB<a class="headerlink" href="#module-obbaa_onusim.mibs.onu_data" title="Permalink to this headline">¶</a></h3>
<p>ONU data MIB (G.988 9.1.3).</p>
<dl class="py data">
<dt id="obbaa_onusim.mibs.onu_data.onu_data_mib">
<code class="sig-prename descclassname">obbaa_onusim.mibs.onu_data.</code><code class="sig-name descname">onu_data_mib</code><em class="property"> = MIB(number=2, name='ONU data', description='Models the MIB itself')</em><a class="headerlink" href="#obbaa_onusim.mibs.onu_data.onu_data_mib" title="Permalink to this definition">¶</a></dt>
<dd><p>Instantiated <a class="reference internal" href="#obbaa_onusim.mib.MIB" title="obbaa_onusim.mib.MIB"><code class="xref any py py-class docutils literal notranslate"><span class="pre">MIB</span></code></a>.</p>
</dd></dl>

</div>
<div class="section" id="module-obbaa_onusim.mibs.software_image">
<span id="software-image-mib"></span><h3>Software image MIB<a class="headerlink" href="#module-obbaa_onusim.mibs.software_image" title="Permalink to this headline">¶</a></h3>
<p>Software image MIB (G.988 9.1.4).</p>
<dl class="py data">
<dt id="obbaa_onusim.mibs.software_image.software_image_mib">
<code class="sig-prename descclassname">obbaa_onusim.mibs.software_image.</code><code class="sig-name descname">software_image_mib</code><em class="property"> = MIB(number=7, name='Software image', description='Models an executable software image')</em><a class="headerlink" href="#obbaa_onusim.mibs.software_image.software_image_mib" title="Permalink to this definition">¶</a></dt>
<dd><p>Instantiated <a class="reference internal" href="#obbaa_onusim.mib.MIB" title="obbaa_onusim.mib.MIB"><code class="xref any py py-class docutils literal notranslate"><span class="pre">MIB</span></code></a>.</p>
</dd></dl>

</div>
</div>
<div class="section" id="module-obbaa_onusim.database">
<span id="database"></span><h2><span class="section-number">4.4. </span>Database<a class="headerlink" href="#module-obbaa_onusim.database" title="Permalink to this headline">¶</a></h2>
<p>MIB database access.</p>
<p>This will currently only really work on the server side, but it makes sense
also to have a client-side database, populated via <a class="reference internal" href="#obbaa_onusim.actions.get.get_action" title="obbaa_onusim.actions.get.get_action"><code class="xref any py py-data docutils literal notranslate"><span class="pre">get</span></code></a> and
<a class="reference internal" href="#obbaa_onusim.actions.upload.mib_upload_action" title="obbaa_onusim.actions.upload.mib_upload_action"><code class="xref any py py-data docutils literal notranslate"><span class="pre">MIB</span> <span class="pre">upload</span></code></a> actions.</p>
<dl class="py data">
<dt id="obbaa_onusim.database.specs">
<code class="sig-prename descclassname">obbaa_onusim.database.</code><code class="sig-name descname">specs</code><em class="property"> = ((MIB(number=256, name='ONU-G', description='Represents the ONU as equipment'), ({'me_inst': 0, 'vendor_id': 1234, 'version': 'v2', 'serial_number': ('abcdefgh', 5678)},)), (MIB(number=257, name='ONU2-G', description='Contains additional attributes associated with a PON ONU'), ({'me_inst': 0, 'omcc_version': 180, 'sys_up_time': &lt;function &lt;lambda&gt;&gt;},)), (MIB(number=2, name='ONU data', description='Models the MIB itself'), ({'me_inst': 0, 'mib_data_sync': 0},)), (MIB(number=7, name='Software image', description='Models an executable software image'), ({'me_inst': 0}, {'me_inst': 1}, {'me_inst': 256}, {'me_inst': 257})))</em><a class="headerlink" href="#obbaa_onusim.database.specs" title="Permalink to this definition">¶</a></dt>
<dd><p>MIB instance specs (these are instantiated on all ONUs).</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>These specs should be read from JSON/YAML files.</p>
</div>
</dd></dl>

<dl class="py data">
<dt id="obbaa_onusim.database.mibs">
<code class="sig-prename descclassname">obbaa_onusim.database.</code><code class="sig-name descname">mibs</code><em class="property"> = {2: MIB(number=2, name='ONU data', description='Models the MIB itself'), 7: MIB(number=7, name='Software image', description='Models an executable software image'), 256: MIB(number=256, name='ONU-G', description='Represents the ONU as equipment'), 257: MIB(number=257, name='ONU2-G', description='Contains additional attributes associated with a PON ONU')}</em><a class="headerlink" href="#obbaa_onusim.database.mibs" title="Permalink to this definition">¶</a></dt>
<dd><p>Implemented MIBs, i.e. the MIBs referenced by the MIB instance specs.</p>
</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.database.Results">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.database.</code><code class="sig-name descname">Results</code><a class="headerlink" href="#obbaa_onusim.database.Results" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Database results class (used for all database operations).</p>
<dl class="py method">
<dt id="obbaa_onusim.database.Results.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.database.Results.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Database results constructor.</p>
</dd></dl>

<dl class="py attribute">
<dt id="obbaa_onusim.database.Results.reason">
<code class="sig-name descname">reason</code><em class="property">: int</em><a class="headerlink" href="#obbaa_onusim.database.Results.reason" title="Permalink to this definition">¶</a></dt>
<dd><p>Reason, result (used by all operations).</p>
</dd></dl>

<dl class="py attribute">
<dt id="obbaa_onusim.database.Results.attr_mask">
<code class="sig-name descname">attr_mask</code><em class="property">: int</em><a class="headerlink" href="#obbaa_onusim.database.Results.attr_mask" title="Permalink to this definition">¶</a></dt>
<dd><p>Attribute mask (used by most operations).</p>
</dd></dl>

<dl class="py attribute">
<dt id="obbaa_onusim.database.Results.opt_attr_mask">
<code class="sig-name descname">opt_attr_mask</code><em class="property">: int</em><a class="headerlink" href="#obbaa_onusim.database.Results.opt_attr_mask" title="Permalink to this definition">¶</a></dt>
<dd><p>Optional-attribute mask (used with reason 0b1001).</p>
</dd></dl>

<dl class="py attribute">
<dt id="obbaa_onusim.database.Results.attr_exec_mask">
<code class="sig-name descname">attr_exec_mask</code><em class="property">: int</em><a class="headerlink" href="#obbaa_onusim.database.Results.attr_exec_mask" title="Permalink to this definition">¶</a></dt>
<dd><p>Attribute-execution mask (used with reason 0b1001).</p>
</dd></dl>

<dl class="py attribute">
<dt id="obbaa_onusim.database.Results.attrs">
<code class="sig-name descname">attrs</code><em class="property">: List[Tuple[Attr, AttrDataValues]]</em><a class="headerlink" href="#obbaa_onusim.database.Results.attrs" title="Permalink to this definition">¶</a></dt>
<dd><p>Attributes and their values (used by <a class="reference internal" href="#obbaa_onusim.database.Database.get" title="obbaa_onusim.database.Database.get"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">Database.get</span></code></a>).</p>
</dd></dl>

<dl class="py attribute">
<dt id="obbaa_onusim.database.Results.num_upload_nexts">
<code class="sig-name descname">num_upload_nexts</code><em class="property">: int</em><a class="headerlink" href="#obbaa_onusim.database.Results.num_upload_nexts" title="Permalink to this definition">¶</a></dt>
<dd><p>Number of upload-nexts (used by <a class="reference internal" href="#obbaa_onusim.database.Database.upload" title="obbaa_onusim.database.Database.upload"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">Database.upload</span></code></a>).</p>
</dd></dl>

<dl class="py attribute">
<dt id="obbaa_onusim.database.Results.body">
<code class="sig-name descname">body</code><em class="property">: List[int, List[Snapshot]]</em><a class="headerlink" href="#obbaa_onusim.database.Results.body" title="Permalink to this definition">¶</a></dt>
<dd><p>Next message body (used by <a class="reference internal" href="#obbaa_onusim.database.Database.upload_next" title="obbaa_onusim.database.Database.upload_next"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">Database.upload_next</span></code></a>).</p>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.database.Results.__str__">
<code class="sig-name descname">__str__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.database.Results.__str__" title="Permalink to this definition">¶</a></dt>
<dd><p>Return str(self).</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.database.Database">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.database.</code><code class="sig-name descname">Database</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">onu_id_range</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.database.Database" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>MIB database class.</p>
<dl class="py method">
<dt id="obbaa_onusim.database.Database.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">onu_id_range</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.database.Database.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>MIB database constructor.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>onu_id_range</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">range</span></code>) – ONU id range, e.g. <code class="docutils literal notranslate"><span class="pre">range(10)</span></code> means ONU ids 0, 1,
…9. An identical database is instantiated for each of these
ONU ids.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.database.Database.set">
<code class="sig-name descname">set</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">onu_id</span></em>, <em class="sig-param"><span class="n">me_class</span></em>, <em class="sig-param"><span class="n">me_inst</span></em>, <em class="sig-param"><span class="n">attr_mask</span></em>, <em class="sig-param"><span class="n">values</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">extended</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.database.Database.set" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the specified attribute values.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>onu_id</strong> – ONU id.</p></li>
<li><p><strong>me_class</strong> – MIB class.</p></li>
<li><p><strong>me_inst</strong> – MIB instance.</p></li>
<li><p><strong>attr_mask</strong> – attributes to set.</p></li>
<li><p><strong>values</strong> – values to which attributes will be set.</p></li>
<li><p><strong>extended</strong> – whether an extended message has been requested.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#obbaa_onusim.database.Results" title="obbaa_onusim.database.Results"><code class="xref py py-class docutils literal notranslate"><span class="pre">Results</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Results object, including <a class="reference internal" href="#obbaa_onusim.database.Results.reason" title="obbaa_onusim.database.Results.reason"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">reason</span></code></a> and <a class="reference internal" href="#obbaa_onusim.database.Results.opt_attr_mask" title="obbaa_onusim.database.Results.opt_attr_mask"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">opt_attr_mask</span></code></a>.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.database.Database.get">
<code class="sig-name descname">get</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">onu_id</span></em>, <em class="sig-param"><span class="n">me_class</span></em>, <em class="sig-param"><span class="n">me_inst</span></em>, <em class="sig-param"><span class="n">attr_mask</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">extended</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.database.Database.get" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the specified attribute values.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>onu_id</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – ONU id.</p></li>
<li><p><strong>me_class</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – MIB class.</p></li>
<li><p><strong>me_inst</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – MIB instance.</p></li>
<li><p><strong>attr_mask</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – requested attributes.</p></li>
<li><p><strong>extended</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code>) – whether an extended message has been requested.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#obbaa_onusim.database.Results" title="obbaa_onusim.database.Results"><code class="xref py py-class docutils literal notranslate"><span class="pre">Results</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Results object, including <a class="reference internal" href="#obbaa_onusim.database.Results.reason" title="obbaa_onusim.database.Results.reason"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">reason</span></code></a>, <a class="reference internal" href="#obbaa_onusim.database.Results.attr_mask" title="obbaa_onusim.database.Results.attr_mask"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">attr_mask</span></code></a> and
<a class="reference internal" href="#obbaa_onusim.database.Results.opt_attr_mask" title="obbaa_onusim.database.Results.opt_attr_mask"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">opt_attr_mask</span></code></a> and <a class="reference internal" href="#obbaa_onusim.database.Results.attrs" title="obbaa_onusim.database.Results.attrs"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">attrs</span></code></a>.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.database.Database.upload">
<code class="sig-name descname">upload</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">onu_id</span></em>, <em class="sig-param"><span class="n">me_class</span></em>, <em class="sig-param"><span class="n">me_inst</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">extended</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.database.Database.upload" title="Permalink to this definition">¶</a></dt>
<dd><p>Prepare for uploading MIBs.</p>
<p>This involves taking a snapshot and calculating how many subsequent
<a class="reference internal" href="#obbaa_onusim.database.Database.upload_next" title="obbaa_onusim.database.Database.upload_next"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">Database.upload_next</span></code></a> operations will be needed.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>onu_id</strong> – ONU id.</p></li>
<li><p><strong>me_class</strong> – MIB class (MUST be the ONU Data MIB class, i.e. 2).</p></li>
<li><p><strong>me_inst</strong> – MIB instance (MUST be the ONU Data MIB instance, i.e. 0).</p></li>
<li><p><strong>extended</strong> – whether an extended message has been requested (if so,
the subsequent <a class="reference internal" href="#obbaa_onusim.database.Database.upload_next" title="obbaa_onusim.database.Database.upload_next"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">Database.upload_next</span></code></a> operations MUST
also request extended messages).</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#obbaa_onusim.database.Results" title="obbaa_onusim.database.Results"><code class="xref py py-class docutils literal notranslate"><span class="pre">Results</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Results object, including <a class="reference internal" href="#obbaa_onusim.database.Results.reason" title="obbaa_onusim.database.Results.reason"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">reason</span></code></a> and <a class="reference internal" href="#obbaa_onusim.database.Results.num_upload_nexts" title="obbaa_onusim.database.Results.num_upload_nexts"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">num_upload_nexts</span></code></a>.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.database.Database.upload_next">
<code class="sig-name descname">upload_next</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">onu_id</span></em>, <em class="sig-param"><span class="n">me_class</span></em>, <em class="sig-param"><span class="n">me_inst</span></em>, <em class="sig-param"><span class="n">seq_num</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">extended</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.database.Database.upload_next" title="Permalink to this definition">¶</a></dt>
<dd><p>Upload the next part of a snapshot that was previously saved via
<a class="reference internal" href="#obbaa_onusim.database.Database.upload" title="obbaa_onusim.database.Database.upload"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">Database.upload</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>onu_id</strong> – ONU id.</p></li>
<li><p><strong>me_class</strong> – MIB class (MUST be the ONU Data MIB class, i.e. 2).</p></li>
<li><p><strong>me_inst</strong> – MIB instance (MUST be the ONU Data MIB instance, i.e. 0).</p></li>
<li><p><strong>extended</strong> – whether an extended message has been requested (if so,
the earlier <a class="reference internal" href="#obbaa_onusim.database.Database.upload" title="obbaa_onusim.database.Database.upload"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">Database.upload</span></code></a> operation MUST have also
requested extended messages).</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#obbaa_onusim.database.Results" title="obbaa_onusim.database.Results"><code class="xref py py-class docutils literal notranslate"><span class="pre">Results</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Results object, including <a class="reference internal" href="#obbaa_onusim.database.Results.reason" title="obbaa_onusim.database.Results.reason"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">reason</span></code></a> and <a class="reference internal" href="#obbaa_onusim.database.Results.body" title="obbaa_onusim.database.Results.body"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">body</span></code></a>.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.database.Database.reset">
<code class="sig-name descname">reset</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">onu_id</span></em>, <em class="sig-param"><span class="n">me_class</span></em>, <em class="sig-param"><span class="n">me_inst</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">extended</span><span class="o">=</span><span class="default_value">False</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.database.Database.reset" title="Permalink to this definition">¶</a></dt>
<dd><p>Reset the specified MIB instance.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>onu_id</strong> – ONU id.</p></li>
<li><p><strong>me_class</strong> – MIB class.</p></li>
<li><p><strong>me_inst</strong> – MIB instance.</p></li>
<li><p><strong>extended</strong> – whether an extended message has been requested.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#obbaa_onusim.database.Results" title="obbaa_onusim.database.Results"><code class="xref py py-class docutils literal notranslate"><span class="pre">Results</span></code></a></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Results object, including <a class="reference internal" href="#obbaa_onusim.database.Results.reason" title="obbaa_onusim.database.Results.reason"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">reason</span></code></a>.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="support">
<h2><span class="section-number">4.5. </span>Support<a class="headerlink" href="#support" title="Permalink to this headline">¶</a></h2>
<div class="section" id="module-obbaa_onusim.types">
<span id="types"></span><h3>Types<a class="headerlink" href="#module-obbaa_onusim.types" title="Permalink to this headline">¶</a></h3>
<p>Various common data types.</p>
<dl class="py class">
<dt id="obbaa_onusim.types.Name">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.types.</code><code class="sig-name descname">Name</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">names</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Name" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Name (and description) mixin class.</p>
<dl class="py method">
<dt id="obbaa_onusim.types.Name.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">names</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Name.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize self.  See help(type(self)) for accurate signature.</p>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.Name.__str__">
<code class="sig-name descname">__str__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Name.__str__" title="Permalink to this definition">¶</a></dt>
<dd><p>Return str(self).</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.types.NumberName">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.types.</code><code class="sig-name descname">NumberName</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">number</span></em>, <em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">names</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.NumberName" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.Name" title="obbaa_onusim.types.Name"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.Name</span></code></a></p>
<p>Number, name (and description) mixin class.</p>
<dl class="py method">
<dt id="obbaa_onusim.types.NumberName.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">number</span></em>, <em class="sig-param"><span class="n">name</span></em>, <em class="sig-param"><span class="n">description</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="o">*</span></em>, <em class="sig-param"><span class="n">names</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.NumberName.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize self.  See help(type(self)) for accurate signature.</p>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.NumberName.__str__">
<code class="sig-name descname">__str__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.NumberName.__str__" title="Permalink to this definition">¶</a></dt>
<dd><p>Return str(self).</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.types.AutoGetter">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.types.</code><code class="sig-name descname">AutoGetter</code><a class="headerlink" href="#obbaa_onusim.types.AutoGetter" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Auto-getter mixin class.</p>
<p>Allows <code class="docutils literal notranslate"><span class="pre">instance._attr</span></code> to be accessed (only for read access) as
<code class="docutils literal notranslate"><span class="pre">instance.attr</span></code>.</p>
</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.types.Datum">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.types.</code><code class="sig-name descname">Datum</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">size</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">fixed</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Datum" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.AutoGetter" title="obbaa_onusim.types.AutoGetter"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.AutoGetter</span></code></a></p>
<p>Single data item class.</p>
<p>Defines a single data item of a given type, with support for default and
fixed values, for encoding and decoding values, and for converting
between user and raw values.</p>
<dl class="py method">
<dt id="obbaa_onusim.types.Datum.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">size</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">fixed</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Datum.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Data item constructor.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>size</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – size of data item in bytes.</p></li>
<li><p><strong>default</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="docutils literal notranslate"><span class="pre">None</span></code>]) – default value of data item (used if no value is
specified).</p></li>
<li><p><strong>fixed</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="docutils literal notranslate"><span class="pre">None</span></code>]) – fixed value of data item (takes precedence over the
default; any attempt to define a data item instance with a
different value is an error).</p></li>
</ul>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>A default MUST currently be provided (it determines the type); this
is wrong: the type should come from the subclass.</p>
</div>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.Datum.decode">
<code class="sig-name descname">decode</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">buffer</span></em>, <em class="sig-param"><span class="n">offset</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Datum.decode" title="Permalink to this definition">¶</a></dt>
<dd><p>Decode data item value.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>buffer</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>) – buffer from which to decode the value</p></li>
<li><p><strong>offset</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – byte offset within buffer at which to start decoding</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>], <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><p>Decoded value and updated offset.</p>
<ul class="simple">
<li><p>If there isn’t sufficient data in the buffer, the default
value is returned</p></li>
<li><p>The returned value is a user value (it’s converted from the raw
value)</p></li>
<li><p>The offset is ready to be passed to the next <code class="docutils literal notranslate"><span class="pre">decode</span></code>
invocation</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.Datum.encode">
<code class="sig-name descname">encode</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Datum.encode" title="Permalink to this definition">¶</a></dt>
<dd><p>Encode data item value.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>value</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>, <code class="docutils literal notranslate"><span class="pre">None</span></code>]) – the value to be encoded</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><p>Encoded buffer.</p>
<ul class="simple">
<li><p>If value is <code class="docutils literal notranslate"><span class="pre">None</span></code>, the default value is encoded</p></li>
<li><p>The value is converted to a raw value before encoding</p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.Datum.raw_value">
<code class="sig-name descname">raw_value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Datum.raw_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert data item user value to raw value.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.Datum.value">
<code class="sig-name descname">value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">raw_value</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Datum.value" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert data item raw value to user value.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytearray</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.Datum.__str__">
<code class="sig-name descname">__str__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Datum.__str__" title="Permalink to this definition">¶</a></dt>
<dd><p>Return str(self).</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.types.Bool">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.types.</code><code class="sig-name descname">Bool</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">size</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">fixed</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Bool" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.Datum" title="obbaa_onusim.types.Datum"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.Datum</span></code></a></p>
<p>Boolean data item class.</p>
<dl class="py method">
<dt id="obbaa_onusim.types.Bool.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">size</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">fixed</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Bool.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>The default defaults to false.</p>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.Bool.raw_value">
<code class="sig-name descname">raw_value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Bool.raw_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert data item user value to raw value.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.Bool.value">
<code class="sig-name descname">value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">raw_value</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Bool.value" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert data item raw value to user value.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.types.Enum">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.types.</code><code class="sig-name descname">Enum</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">size</span></em>, <em class="sig-param"><span class="n">values</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">fixed</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Enum" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.Datum" title="obbaa_onusim.types.Datum"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.Datum</span></code></a></p>
<p>Enumeration data item class.</p>
<dl class="py method">
<dt id="obbaa_onusim.types.Enum.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">size</span></em>, <em class="sig-param"><span class="n">values</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">fixed</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Enum.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Data item constructor.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>size</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – size of data item in bytes.</p></li>
<li><p><strong>default</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]) – default value of data item (used if no value is
specified).</p></li>
<li><p><strong>fixed</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]) – fixed value of data item (takes precedence over the
default; any attempt to define a data item instance with a
different value is an error).</p></li>
</ul>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>A default MUST currently be provided (it determines the type); this
is wrong: the type should come from the subclass.</p>
</div>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.Enum.raw_value">
<code class="sig-name descname">raw_value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Enum.raw_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert data item user value to raw value.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.Enum.value">
<code class="sig-name descname">value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">raw_value</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Enum.value" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert data item raw value to user value.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.Enum.__str__">
<code class="sig-name descname">__str__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Enum.__str__" title="Permalink to this definition">¶</a></dt>
<dd><p>Return str(self).</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.types.Bits">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.types.</code><code class="sig-name descname">Bits</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">size</span></em>, <em class="sig-param"><span class="n">values</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">fixed</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Bits" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.Enum" title="obbaa_onusim.types.Enum"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.Enum</span></code></a></p>
<p>Bits data item class.</p>
</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.types.Number">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.types.</code><code class="sig-name descname">Number</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">size</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">fixed</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">units</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Number" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.Datum" title="obbaa_onusim.types.Datum"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.Datum</span></code></a></p>
<p>Number data item class.</p>
<dl class="py method">
<dt id="obbaa_onusim.types.Number.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">size</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">fixed</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">units</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Number.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Data item constructor.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>size</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – size of data item in bytes.</p></li>
<li><p><strong>default</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>]) – default value of data item (used if no value is
specified).</p></li>
<li><p><strong>fixed</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>]) – fixed value of data item (takes precedence over the
default; any attempt to define a data item instance with a
different value is an error).</p></li>
</ul>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>A default MUST currently be provided (it determines the type); this
is wrong: the type should come from the subclass.</p>
</div>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.Number.raw_value">
<code class="sig-name descname">raw_value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Number.raw_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert data item user value to raw value.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.Number.value">
<code class="sig-name descname">value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">raw_value</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Number.value" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert data item raw value to user value.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.types.String">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.types.</code><code class="sig-name descname">String</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">size</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">fixed</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.String" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.Datum" title="obbaa_onusim.types.Datum"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.Datum</span></code></a></p>
<p>String data item class.</p>
<dl class="py method">
<dt id="obbaa_onusim.types.String.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">size</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">fixed</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.String.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Data item constructor.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>size</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – size of data item in bytes.</p></li>
<li><p><strong>default</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]) – default value of data item (used if no value is
specified).</p></li>
<li><p><strong>fixed</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]) – fixed value of data item (takes precedence over the
default; any attempt to define a data item instance with a
different value is an error).</p></li>
</ul>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>A default MUST currently be provided (it determines the type); this
is wrong: the type should come from the subclass.</p>
</div>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.String.raw_value">
<code class="sig-name descname">raw_value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.String.raw_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert data item user value to raw value.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.String.value">
<code class="sig-name descname">value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">raw_value</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.String.value" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert data item raw value to user value.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt id="obbaa_onusim.types.Bytes">
<em class="property">class </em><code class="sig-prename descclassname">obbaa_onusim.types.</code><code class="sig-name descname">Bytes</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">size</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">fixed</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Bytes" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#obbaa_onusim.types.Datum" title="obbaa_onusim.types.Datum"><code class="xref py py-class docutils literal notranslate"><span class="pre">obbaa_onusim.types.Datum</span></code></a></p>
<p>Bytes data item class.</p>
<dl class="py method">
<dt id="obbaa_onusim.types.Bytes.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">size</span></em>, <em class="sig-param"><span class="n">default</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">fixed</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Bytes.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Data item constructor.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>size</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – size of data item in bytes.</p></li>
<li><p><strong>default</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>]) – default value of data item (used if no value is
specified).</p></li>
<li><p><strong>fixed</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>]) – fixed value of data item (takes precedence over the
default; any attempt to define a data item instance with a
different value is an error).</p></li>
</ul>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>A default MUST currently be provided (it determines the type); this
is wrong: the type should come from the subclass.</p>
</div>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.Bytes.raw_value">
<code class="sig-name descname">raw_value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Bytes.raw_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert data item user value to raw value.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt id="obbaa_onusim.types.Bytes.value">
<code class="sig-name descname">value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">raw_value</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.types.Bytes.value" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert data item raw value to user value.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code></p>
</dd>
</dl>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-obbaa_onusim.util">
<span id="utilities"></span><h3>Utilities<a class="headerlink" href="#module-obbaa_onusim.util" title="Permalink to this headline">¶</a></h3>
<p>Various utility functions.</p>
<dl class="py function">
<dt id="obbaa_onusim.util.argparser">
<code class="sig-prename descclassname">obbaa_onusim.util.</code><code class="sig-name descname">argparser</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">prog</span></em>, <em class="sig-param"><span class="n">description</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.util.argparser" title="Permalink to this definition">¶</a></dt>
<dd><p>Argument parser helper.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>prog</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – program name, typically from <code class="docutils literal notranslate"><span class="pre">sys.argv[0]</span></code>.</p></li>
<li><p><strong>description</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – program description, typically from <code class="docutils literal notranslate"><span class="pre">__doc__</span></code>.</p></li>
<li><p><strong>**kwargs</strong> – additional arguments; currently supported keys are
<code class="docutils literal notranslate"><span class="pre">default_xxx</span></code> for argument <code class="docutils literal notranslate"><span class="pre">xxx</span></code>, e.g. <code class="docutils literal notranslate"><span class="pre">default_address</span></code>.</p></li>
</ul>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ArgumentParser</span></code></p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Argument parser, with common options added.</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="obbaa_onusim.util.cleandoc">
<code class="sig-prename descclassname">obbaa_onusim.util.</code><code class="sig-name descname">cleandoc</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">docstring</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.util.cleandoc" title="Permalink to this definition">¶</a></dt>
<dd><p>Clean documentation string (docstring) per PEP 257 rules.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>docstring</strong> – supplied docstring.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Clean docstring.</p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This is just a wrapper around <code class="docutils literal notranslate"><span class="pre">inspect.cleandoc</span></code>.</p>
</div>
</dd></dl>

<dl class="py function">
<dt id="obbaa_onusim.util.indices">
<code class="sig-prename descclassname">obbaa_onusim.util.</code><code class="sig-name descname">indices</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">mask</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.util.indices" title="Permalink to this definition">¶</a></dt>
<dd><p>Attribute indices helper.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>mask</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – the attribute mask for which to return the indices.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<code class="xref py py-data docutils literal notranslate"><span class="pre">Tuple</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>], …]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>Tuple of (<code class="docutils literal notranslate"><span class="pre">index</span></code>, <code class="docutils literal notranslate"><span class="pre">index_mask</span></code>) tuples, where <code class="docutils literal notranslate"><span class="pre">index</span></code> is in the
range 1 through 16 (inclusive).</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="obbaa_onusim.util.openfile">
<code class="sig-prename descclassname">obbaa_onusim.util.</code><code class="sig-name descname">openfile</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">spec</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.util.openfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Open file helper.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>spec</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]) – <p>file/mode spec; for example:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">file</span></code> uses mode <code class="docutils literal notranslate"><span class="pre">w</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">file+</span></code> uses mode <code class="docutils literal notranslate"><span class="pre">a</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">file+r</span></code> uses mode <code class="docutils literal notranslate"><span class="pre">r</span></code></p></li>
</ul>
</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><code class="xref py py-data docutils literal notranslate"><span class="pre">Optional</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">IO</span></code>[<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]]</p>
</dd>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>File object, or <code class="docutils literal notranslate"><span class="pre">None</span></code> if spec is <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt id="obbaa_onusim.util.toint">
<code class="sig-prename descclassname">obbaa_onusim.util.</code><code class="sig-name descname">toint</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">x</span></em><span class="sig-paren">)</span><a class="headerlink" href="#obbaa_onusim.util.toint" title="Permalink to this definition">¶</a></dt>
<dd><p>String to integer conversion helper.</p>
<p>Supports bases 2, 8, 10 and 16.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>x</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Any</span></code>) – value to convert</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Integer.</p>
</dd>
</dl>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>It’ll throw an exception if given an invalid string.</p>
</div>
</dd></dl>

</div>
</div>
</div>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">4. Modules</a><ul>
<li><a class="reference internal" href="#module-obbaa_onusim.endpoint">4.1. Endpoint</a></li>
<li><a class="reference internal" href="#messages-and-actions">4.2. Messages and Actions</a><ul>
<li><a class="reference internal" href="#module-obbaa_onusim.message">Message classes</a></li>
<li><a class="reference internal" href="#module-obbaa_onusim.action">Action classes</a></li>
<li><a class="reference internal" href="#module-obbaa_onusim.actions.set">Set action</a></li>
<li><a class="reference internal" href="#module-obbaa_onusim.actions.get">Get action</a></li>
<li><a class="reference internal" href="#module-obbaa_onusim.actions.upload">MIB upload and  MIB upload next actions</a></li>
<li><a class="reference internal" href="#module-obbaa_onusim.actions.reset">MIB reset action</a></li>
</ul>
</li>
<li><a class="reference internal" href="#mibs">4.3. MIBs</a><ul>
<li><a class="reference internal" href="#module-obbaa_onusim.mib">MIB classes</a></li>
<li><a class="reference internal" href="#module-obbaa_onusim.mibs.onu_g">ONU-G MIB</a></li>
<li><a class="reference internal" href="#module-obbaa_onusim.mibs.onu2_g">ONU2-G MIB</a></li>
<li><a class="reference internal" href="#module-obbaa_onusim.mibs.onu_data">ONU data MIB</a></li>
<li><a class="reference internal" href="#module-obbaa_onusim.mibs.software_image">Software image MIB</a></li>
</ul>
</li>
<li><a class="reference internal" href="#module-obbaa_onusim.database">4.4. Database</a></li>
<li><a class="reference internal" href="#support">4.5. Support</a><ul>
<li><a class="reference internal" href="#module-obbaa_onusim.types">Types</a></li>
<li><a class="reference internal" href="#module-obbaa_onusim.util">Utilities</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="../bin/index.html"
                        title="previous chapter"><span class="section-number">3. </span>Scripts</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="../usage/documentation.html"
                        title="next chapter"><span class="section-number">5. </span>Documentation</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/obbaa_onusim/index.md.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../usage/documentation.html" title="5. Documentation"
             >next</a> |</li>
        <li class="right" >
          <a href="../bin/index.html" title="3. Scripts"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">onusim  documentation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href=""><span class="section-number">4. </span>Modules</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2020, Broadband Forum.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.1.0+.
    </div>
  </body>
</html>